package com.itheima.stock.mapper;

import com.itheima.stock.pojo.Stock4EvrDayDomain;
import com.itheima.stock.pojo.Stock4MinuteDomain;
import com.itheima.stock.pojo.StockUpdownDomain;
import com.itheima.stock.pojo.po.StockRtInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author Administrator
* @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
* @createDate 2022-03-12 20:30:27
* @Entity com.itheima.stock.pojo.po.StockRtInfo
*/
public interface StockRtInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    List<StockUpdownDomain> stockAll();

    /**
     * 统计指定日期内涨停或者跌停的数据
     * 日期范围不能失效，否则分库分表查询失效
     * @param curTime 股票交易时间
     * @param openDate 对应的开盘日期
     * @param flag 1：涨停 0：跌停
     * @return
     */
    List<Map> upDownCount(@Param("avlDate") Date curTime, @Param("openDate") Date openDate, @Param("flag") Integer flag);
    /**
     * 统计指定时间点下，各个涨跌区间内股票的个数
     * @param avlDate
     * @return
     */
    List<Map> stockUpDownScopeCount(@Param("avlDate")Date date);

    List<Stock4MinuteDomain> stockScreenTimeSharing(@Param("stockCode")String code, @Param("startDate")Date openDate,  @Param("endtDate")Date date);

    List<Stock4EvrDayDomain> stockCreenDkLine(@Param("stockCode")String stockCode, @Param("beginDate")Date openDate, @Param("endDate")Date date);

    void insertBatch(@Param("stockRtInfos") List<StockRtInfo> infos);
}
